package com.example.facemanager.vo;

import lombok.Data;

import java.io.Serializable;

/**
 * @Author huchenying
 * @Date 2022/8/3 09:50
 * @Description
 */
@Data
public class ReturnMsg implements Serializable {
    private int code;
    private String msg;
    private Object data;

    public static ReturnMsg success() {
        ReturnMsg returnMsg = new ReturnMsg();
        returnMsg.setMsg("请求成功。");
        returnMsg.setCode(200);
        return returnMsg;
    }

    public static ReturnMsg success(Object data) {
        ReturnMsg returnMsg = new ReturnMsg();
        returnMsg.setMsg("请求成功。");
        returnMsg.setCode(200);
        returnMsg.setData(data);
        return returnMsg;
    }

    public static ReturnMsg fail() {
        ReturnMsg returnMsg = new ReturnMsg();
        returnMsg.setMsg("请求失败。");
        returnMsg.setCode(400);
        return returnMsg;
    }

    public static ReturnMsg fail(String message) {
        ReturnMsg returnMsg = new ReturnMsg();
        returnMsg.setMsg(message);
        returnMsg.setCode(400);
        return returnMsg;
    }

}
